﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Actualizar.aspx.vb" Inherits="Libreria.Formulario_web110" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <asp:Label ID="Label1" runat="server" Text="Codigo"></asp:Label>
        <asp:TextBox ID="TxtDate" runat="server"></asp:TextBox>
        <asp:Button ID="BtnBuscar" runat="server" Text="Button" />
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="title_id" 
            DataSourceID="SqlDataSource1" DefaultMode="Insert">
            <EditItemTemplate>
                title_id:
                <asp:Label ID="title_idLabel1" runat="server" Text='<%# Eval("title_id") %>' />
                <br />
                title:
                <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
                <br />
                type:
                <asp:TextBox ID="typeTextBox" runat="server" Text='<%# Bind("type") %>' />
                <br />
                pub_id:
                <asp:TextBox ID="pub_idTextBox" runat="server" Text='<%# Bind("pub_id") %>' />
                <br />
                price:
                <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                <br />
                advance:
                <asp:TextBox ID="advanceTextBox" runat="server" Text='<%# Bind("advance") %>' />
                <br />
                royalty:
                <asp:TextBox ID="royaltyTextBox" runat="server" Text='<%# Bind("royalty") %>' />
                <br />
                ytd_sales:
                <asp:TextBox ID="ytd_salesTextBox" runat="server" 
                    Text='<%# Bind("ytd_sales") %>' />
                <br />
                notes:
                <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                pubdate:
                <asp:TextBox ID="pubdateTextBox" runat="server" Text='<%# Bind("pubdate") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Actualizar" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </EditItemTemplate>
            <InsertItemTemplate>
                title_id:
                <asp:TextBox ID="title_idTextBox" runat="server" 
                    Text='<%# Bind("title_id") %>' />
                <br />
                title:
                <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
                <br />
                type:
                <asp:TextBox ID="typeTextBox" runat="server" Text='<%# Bind("type") %>' />
                <br />
                pub_id:
                <asp:TextBox ID="pub_idTextBox" runat="server" Text='<%# Bind("pub_id") %>' />
                <br />
                price:
                <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                <br />
                advance:
                <asp:TextBox ID="advanceTextBox" runat="server" Text='<%# Bind("advance") %>' />
                <br />
                royalty:
                <asp:TextBox ID="royaltyTextBox" runat="server" Text='<%# Bind("royalty") %>' />
                <br />
                ytd_sales:
                <asp:TextBox ID="ytd_salesTextBox" runat="server" 
                    Text='<%# Bind("ytd_sales") %>' />
                <br />
                notes:
                <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                pubdate:
                <asp:TextBox ID="pubdateTextBox" runat="server" Text='<%# Bind("pubdate") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insertar" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
                title_id:
                <asp:Label ID="title_idLabel" runat="server" Text='<%# Eval("title_id") %>' />
                <br />
                title:
                <asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>' />
                <br />
                type:
                <asp:Label ID="typeLabel" runat="server" Text='<%# Bind("type") %>' />
                <br />
                pub_id:
                <asp:Label ID="pub_idLabel" runat="server" Text='<%# Bind("pub_id") %>' />
                <br />
                price:
                <asp:Label ID="priceLabel" runat="server" Text='<%# Bind("price") %>' />
                <br />
                advance:
                <asp:Label ID="advanceLabel" runat="server" Text='<%# Bind("advance") %>' />
                <br />
                royalty:
                <asp:Label ID="royaltyLabel" runat="server" Text='<%# Bind("royalty") %>' />
                <br />
                ytd_sales:
                <asp:Label ID="ytd_salesLabel" runat="server" Text='<%# Bind("ytd_sales") %>' />
                <br />
                notes:
                <asp:Label ID="notesLabel" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                pubdate:
                <asp:Label ID="pubdateLabel" runat="server" Text='<%# Bind("pubdate") %>' />
                <br />

            </ItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:pubsConnectionString12 %>" 
            DeleteCommand="DELETE FROM [titles] WHERE [title_id] = @original_title_id AND [title] = @original_title AND [type] = @original_type AND (([pub_id] = @original_pub_id) OR ([pub_id] IS NULL AND @original_pub_id IS NULL)) AND (([price] = @original_price) OR ([price] IS NULL AND @original_price IS NULL)) AND (([advance] = @original_advance) OR ([advance] IS NULL AND @original_advance IS NULL)) AND (([royalty] = @original_royalty) OR ([royalty] IS NULL AND @original_royalty IS NULL)) AND (([ytd_sales] = @original_ytd_sales) OR ([ytd_sales] IS NULL AND @original_ytd_sales IS NULL)) AND (([notes] = @original_notes) OR ([notes] IS NULL AND @original_notes IS NULL)) AND [pubdate] = @original_pubdate" 
            InsertCommand="INSERT INTO [titles] ([title_id], [title], [type], [pub_id], [price], [advance], [royalty], [ytd_sales], [notes], [pubdate]) VALUES (@title_id, @title, @type, @pub_id, @price, @advance, @royalty, @ytd_sales, @notes, @pubdate)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [titles]" 
            UpdateCommand="UPDATE [titles] SET [title] = @title, [type] = @type, [pub_id] = @pub_id, [price] = @price, [advance] = @advance, [royalty] = @royalty, [ytd_sales] = @ytd_sales, [notes] = @notes, [pubdate] = @pubdate WHERE [title_id] = @original_title_id AND [title] = @original_title AND [type] = @original_type AND (([pub_id] = @original_pub_id) OR ([pub_id] IS NULL AND @original_pub_id IS NULL)) AND (([price] = @original_price) OR ([price] IS NULL AND @original_price IS NULL)) AND (([advance] = @original_advance) OR ([advance] IS NULL AND @original_advance IS NULL)) AND (([royalty] = @original_royalty) OR ([royalty] IS NULL AND @original_royalty IS NULL)) AND (([ytd_sales] = @original_ytd_sales) OR ([ytd_sales] IS NULL AND @original_ytd_sales IS NULL)) AND (([notes] = @original_notes) OR ([notes] IS NULL AND @original_notes IS NULL)) AND [pubdate] = @original_pubdate">
            <DeleteParameters>
                <asp:Parameter Name="original_title_id" Type="String" />
                <asp:Parameter Name="original_title" Type="String" />
                <asp:Parameter Name="original_type" Type="String" />
                <asp:Parameter Name="original_pub_id" Type="String" />
                <asp:Parameter Name="original_price" Type="Decimal" />
                <asp:Parameter Name="original_advance" Type="Decimal" />
                <asp:Parameter Name="original_royalty" Type="Int32" />
                <asp:Parameter Name="original_ytd_sales" Type="Int32" />
                <asp:Parameter Name="original_notes" Type="String" />
                <asp:Parameter Name="original_pubdate" Type="DateTime" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="title_id" Type="String" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="type" Type="String" />
                <asp:Parameter Name="pub_id" Type="String" />
                <asp:Parameter Name="price" Type="Decimal" />
                <asp:Parameter Name="advance" Type="Decimal" />
                <asp:Parameter Name="royalty" Type="Int32" />
                <asp:Parameter Name="ytd_sales" Type="Int32" />
                <asp:Parameter Name="notes" Type="String" />
                <asp:Parameter Name="pubdate" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="type" Type="String" />
                <asp:Parameter Name="pub_id" Type="String" />
                <asp:Parameter Name="price" Type="Decimal" />
                <asp:Parameter Name="advance" Type="Decimal" />
                <asp:Parameter Name="royalty" Type="Int32" />
                <asp:Parameter Name="ytd_sales" Type="Int32" />
                <asp:Parameter Name="notes" Type="String" />
                <asp:Parameter Name="pubdate" Type="DateTime" />
                <asp:Parameter Name="original_title_id" Type="String" />
                <asp:Parameter Name="original_title" Type="String" />
                <asp:Parameter Name="original_type" Type="String" />
                <asp:Parameter Name="original_pub_id" Type="String" />
                <asp:Parameter Name="original_price" Type="Decimal" />
                <asp:Parameter Name="original_advance" Type="Decimal" />
                <asp:Parameter Name="original_royalty" Type="Int32" />
                <asp:Parameter Name="original_ytd_sales" Type="Int32" />
                <asp:Parameter Name="original_notes" Type="String" />
                <asp:Parameter Name="original_pubdate" Type="DateTime" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="title_id" 
            DataSourceID="SqlDataSource1" InsertItemPosition="LastItem">
            <AlternatingItemTemplate>
                <tr style="background-color: #FAFAD2;color: #284775;">
                    <td>
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                            Text="Eliminar" />
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Editar" />
                    </td>
                    <td>
                        <asp:Label ID="title_idLabel" runat="server" Text='<%# Eval("title_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
                    </td>
                    <td>
                        <asp:Label ID="typeLabel" runat="server" Text='<%# Eval("type") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pub_idLabel" runat="server" Text='<%# Eval("pub_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                    </td>
                    <td>
                        <asp:Label ID="advanceLabel" runat="server" Text='<%# Eval("advance") %>' />
                    </td>
                    <td>
                        <asp:Label ID="royaltyLabel" runat="server" Text='<%# Eval("royalty") %>' />
                    </td>
                    <td>
                        <asp:Label ID="ytd_salesLabel" runat="server" Text='<%# Eval("ytd_sales") %>' />
                    </td>
                    <td>
                        <asp:Label ID="notesLabel" runat="server" Text='<%# Eval("notes") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pubdateLabel" runat="server" Text='<%# Eval("pubdate") %>' />
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <tr style="background-color: #FFCC66;color: #000080;">
                    <td>
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Actualizar" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancelar" />
                    </td>
                    <td>
                        <asp:Label ID="title_idLabel1" runat="server" Text='<%# Eval("title_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="typeTextBox" runat="server" Text='<%# Bind("type") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="pub_idTextBox" runat="server" Text='<%# Bind("pub_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="advanceTextBox" runat="server" Text='<%# Bind("advance") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="royaltyTextBox" runat="server" Text='<%# Bind("royalty") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="ytd_salesTextBox" runat="server" 
                            Text='<%# Bind("ytd_sales") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="pubdateTextBox" runat="server" Text='<%# Bind("pubdate") %>' />
                    </td>
                </tr>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" 
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                    <tr>
                        <td>
                            No se han devuelto datos.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                            Text="Insertar" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Borrar" />
                    </td>
                    <td>
                        <asp:TextBox ID="title_idTextBox" runat="server" 
                            Text='<%# Bind("title_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="typeTextBox" runat="server" Text='<%# Bind("type") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="pub_idTextBox" runat="server" Text='<%# Bind("pub_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="advanceTextBox" runat="server" Text='<%# Bind("advance") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="royaltyTextBox" runat="server" Text='<%# Bind("royalty") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="ytd_salesTextBox" runat="server" 
                            Text='<%# Bind("ytd_sales") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="pubdateTextBox" runat="server" Text='<%# Bind("pubdate") %>' />
                    </td>
                </tr>
            </InsertItemTemplate>
            <ItemTemplate>
                <tr style="background-color: #FFFBD6;color: #333333;">
                    <td>
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                            Text="Eliminar" />
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Editar" />
                    </td>
                    <td>
                        <asp:Label ID="title_idLabel" runat="server" Text='<%# Eval("title_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
                    </td>
                    <td>
                        <asp:Label ID="typeLabel" runat="server" Text='<%# Eval("type") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pub_idLabel" runat="server" Text='<%# Eval("pub_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                    </td>
                    <td>
                        <asp:Label ID="advanceLabel" runat="server" Text='<%# Eval("advance") %>' />
                    </td>
                    <td>
                        <asp:Label ID="royaltyLabel" runat="server" Text='<%# Eval("royalty") %>' />
                    </td>
                    <td>
                        <asp:Label ID="ytd_salesLabel" runat="server" Text='<%# Eval("ytd_sales") %>' />
                    </td>
                    <td>
                        <asp:Label ID="notesLabel" runat="server" Text='<%# Eval("notes") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pubdateLabel" runat="server" Text='<%# Eval("pubdate") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="itemPlaceholderContainer" runat="server" border="1" 
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                <tr runat="server" style="background-color: #FFFBD6;color: #333333;">
                                    <th runat="server">
                                    </th>
                                    <th runat="server">
                                        title_id</th>
                                    <th runat="server">
                                        title</th>
                                    <th runat="server">
                                        type</th>
                                    <th runat="server">
                                        pub_id</th>
                                    <th runat="server">
                                        price</th>
                                    <th runat="server">
                                        advance</th>
                                    <th runat="server">
                                        royalty</th>
                                    <th runat="server">
                                        ytd_sales</th>
                                    <th runat="server">
                                        notes</th>
                                    <th runat="server">
                                        pubdate</th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" 
                            style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <tr style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                    <td>
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                            Text="Eliminar" />
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Editar" />
                    </td>
                    <td>
                        <asp:Label ID="title_idLabel" runat="server" Text='<%# Eval("title_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
                    </td>
                    <td>
                        <asp:Label ID="typeLabel" runat="server" Text='<%# Eval("type") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pub_idLabel" runat="server" Text='<%# Eval("pub_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                    </td>
                    <td>
                        <asp:Label ID="advanceLabel" runat="server" Text='<%# Eval("advance") %>' />
                    </td>
                    <td>
                        <asp:Label ID="royaltyLabel" runat="server" Text='<%# Eval("royalty") %>' />
                    </td>
                    <td>
                        <asp:Label ID="ytd_salesLabel" runat="server" Text='<%# Eval("ytd_sales") %>' />
                    </td>
                    <td>
                        <asp:Label ID="notesLabel" runat="server" Text='<%# Eval("notes") %>' />
                    </td>
                    <td>
                        <asp:Label ID="pubdateLabel" runat="server" Text='<%# Eval("pubdate") %>' />
                    </td>
                </tr>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>
    </p>
</asp:Content>
